package spring.batch;

import org.springframework.batch.item.file.mapping.FieldSetMapper;
import org.springframework.batch.item.file.transform.FieldSet;
import org.springframework.validation.BindException;

/**
 * Created by huhx on 2017-07-18.
 */
public class LoanStatusMapper implements FieldSetMapper<LoanStatusBean> {

    @Override
    public LoanStatusBean mapFieldSet(FieldSet fs) throws BindException {
        LoanStatusBean bean = new LoanStatusBean();
        bean.setIdNo(fs.readString(0));
        bean.setName(fs.readString(1));
        bean.setAge(fs.readInt(2));
        bean.setLoanMoney(fs.readBigDecimal(3));
        bean.setStatus(fs.readString(4));
        bean.setAddress(fs.readString(5));
        bean.setMarryStatus(fs.readString(6));
        bean.setAccountNo(fs.readRawString(7));
        bean.setBalance(fs.readRawString(8));
        return bean;
    }
}
